<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/common/includes.jsp" %>
<html>
 <head>
    <title>快照管理</title>
	<%@ include file="/common/meta.jsp" %>
	<script src="${ctx}/js/ligerUI/js/plugins/ligerLayout.js" type="text/javascript"></script>
	<script src="${ctx}/js/jsp/comm.js" type="text/javascript"></script>
	<script type="text/javascript">
		var basic_Url="${ctx}/logic/snapshot";
		var basic_WUrl="/logic/snapshot";
		var basic_Title="快照管理";
		var grid;
		function createSearch(){
			init(1,7,'60,20,100,20,100,60,100','10%');
			//第一行的数据
			addCommon(0,0,"lable","快照时间：");
			addCommon(0,1,"lable","从");
			addCommon(0,2,"datestart","zd027SnapshotDate");
			addCommon(0,3,"lable","到：");
			addCommon(0,4,"dateend","zd027SnapshotDate");
			addCommon(0,5,"lable","仓库：");
 			addCommon(0,6,"selectEnum","zd001WhName","<option></option><c:forEach var="s" items="${wh}"><option value='${s.name}'>${s.name}</option></c:forEach>");
		}
		
		function searchAP(){
			multipleSearch("#table1",true,"",basic_Url+"/list.do");
		}
		document.onkeydown=keyListener;   
		function keyListener(e){   
		    e = e ? e : event;  
		    if(e.keyCode == 13){   
		    	searchAP();
		    }   
		}  	
		$(function(){
			grid = $("#table1").ligerGrid({
		        columns: [
		                  { display: '仓库编码', name: 'zd001WhCode', width: 120 },
		                  { display: '仓库名称', name: 'zd001WhName', width: 100},
		                  { display: '仓位编码', name: 'zd002WhLocationCode', width: 120,hide:true},
		                  { display: '仓位名称', name: 'zd002WhLocationName', width:100,hide:true},
		                  { display: '仓位名称', name: 'zd002WhLocationId', width:100,hide:true},
		                  { display: '物料编码', name: 'zd004MaterialsCode', width: 120},
		                  { display: '物料名称', name: 'zd005MaterialsName', width:100},
		                  { display: 'PI号', name: 'zd020Batch', width: 120},
		                  { display: '基本库存', name: 'zd009Quantity', width: 120},
		                  { display: '在途库存', name: 'zd011TravelingQuantity',
			                	render: function (item){
			                		if(item.zd011TravelingQuantity==''||item.zd011TravelingQuantity==null||parseFloat(item.zd011TravelingQuantity)==0){
			                			return '0.0';
			                		}
			                	 return item.zd011TravelingQuantity;
			                }}, 
			                { display: '总库存', name: 'Stocks', width: 180,
			                	render: function (item){
			                	 return parseFloat(item.zd011TravelingQuantity)+parseFloat(item.zd022MaterialsProDate);
			                }},   
		                  { display: '生产日期', name: 'zd022MaterialsProDate', width: 180,hide:true,
		                	  render: function (item){
		                		  var cdate=new Date(item.zd022MaterialsProDate);
		                		  return formatDate(cdate,"yyyy-MM-dd");
		                	  }},
			              { display: '快照时间', name: 'zd027SnapshotDate', width: 180,
			                	render: function (item){
			                	var cdate=new Date(item.zd027SnapshotDate);
			                	return formatDate(cdate,"yyyy-MM-dd");
			                  }}
		                  ],
		                  enabledEdit: true,
		                  usePager: true, rownumbers: true, 
		                  pageSize:15,
		                  pageSizeOptions :[15,25,35],
		                  url:basic_Url+"/list.do",
		                  width: "100%", height:'100%',
		                  enabledSort:false
		                  });
			$("#pageloading").hide();
			});
		</script>
	 
  </head>
 <body style="padding:10px" onload="createSearch()">  
       <div id="layout1">

          <div id="pageHeader" class="pageHeader">
               <div class="searchBar" id="multipleSearchDialog">
	                <table class="table" width="100%" id="searchHeader" >  
                        <tbody id="newbody">
                        </tbody>
 	                </table>
                    <div class="subBar">
			             <ul>
				             <li><div class="buttonActive"><div class="buttonContent"><button type="submit" id="btnSearch" onclick="searchAP()">查询</button></div></div></li>
				             <li><a class="button" onclick="clearSearch()"><span>重置</span></a></li>
			             </ul>
	                </div>
               </div>
          </div>
      </div>
      <div position="center" id="table1">
      </div>
      <div class="clear"></div>
    </body>
</html>